home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-15 | 23.7 KB | 740 lines | [TEXT/MPS ] |
- //
- // customUI.r - demonstrates customized User Interface for the Installer
- //
- //
- // This example demonstrates usage of the Easy and Custom Frameworks
- // to construct Easy Install and a Custom Install selections.
- //
- // Also included are examples to create package comments for all
- // Custom Install packages, Custom Install subpackages, Custom
- // Removal packages, and the method for allowing the user to
- // select the volume and folder as the target for the installation.
- //
- // Customizable help screens are implemented.
- //
- //
- // mark young • 08/18/94
- //
- // Copyright 1993-1994, Apple Computer, Inc., All Rights Reserved
- //
-
- #include "InstallerTypes.r"
-
- #define kMainPackage 100
- #define kDividerPackage 9999
-
- // • easy install setup
-
- // easy install framework uses ID other than 765 or 766
- // recommended to always use ID 764
- resource 'infr' (764) {
- format0 {{
- pickFirst, { 700 },
- }}
- };
-
- // rule that adds main package to Easy Install
- resource 'inrl' (700) {
- format0 {{
- // add main package and description to Easy Install package list
- AddPackages{{ kMainPackage }},
- AddUserDescription{ "Install three copies of TeachText to your hard disk." },
- }}
- };
-
- // • custom install setup
-
- // custom install framework always uses ID of 766
- resource 'infr' (766) {
- format0 {{
- pickFirst, { 800 }, // check system version, if bad give error
- }}
- };
-
- // rule that adds main package to Custom Install
- resource 'inrl' (800) {
- format0 {{
- // add main package to Custom Install package list
- AddCustomItems{{ kMainPackage }},
- }}
- };
-
-
-
- // • packages
-
- resource 'inpk' ( kMainPackage ) {
- format0 {
- showsOnCustom, // ignored in packages that are added
- // to Custom Install via AddCustomItems
- // which places packages in the highest
- // level of Custom Install choice list
-
- removable, // show under Custom Remove when item
- // added to Custom Install via
- // AddCustomItems
-
- dontForceRestart, // don't make user reboot after installation
-
- kMainPackage, // package comments resource ID
-
- 0, // package size ( if 0, filled by ScriptCheck )
-
- "Everything", // Custom Install selection description
- {
- 'inpk', 200; // a subpackage
- 'inpk', 300; // a subpackage
- 'inpk', kDividerPackage;// divider line between subpackages
- 'inpk', 400; // a subpackage
- },
- }
- };
-
- resource 'inpk' (200) {
- format0 {
- showsOnCustom, // show the package as a selectable item
- // item when used as a subpackage
-
- removable, // show under Custom Remove as a selectable
- // item, when package is a subpackage
-
- dontForceRestart, // don't make user reboot after installation
-
- 200, // package comments resource ID
-
- 0, // package size ( if 0, filled by ScriptCheck )
-
- "TeachText • 1", // Custom Install selection description
- {
- 'infa', 2000; // file to install or remove
- },
- }
- };
-
- resource 'inpk' (300) {
- format0 {
- showsOnCustom, // show the package as a selectable item
- // item when used as a subpackage
-
- removable, // show under Custom Remove as a selectable
- // item, when package is a subpackage
-
- dontForceRestart, // don't make user reboot after installation
-
- 300, // package comments resource ID
-
- 0, // package size ( if 0, filled by ScriptCheck )
-
- "TeachText • 2", // Custom Install selection description
- {
- 'infa', 3000; // file to install or remove
- },
- }
- };
-
- resource 'inpk' (400) {
- format0 {
- showsOnCustom, // show the package as a selectable item
- // item when used as a subpackage
-
- notRemovable, // show under Custom Remove as a selectable
- // item, when package is a subpackage
- // • be sure that this item is not available
- // to be selected under Custom Remove
-
- dontForceRestart, // don't make user reboot after installation
-
- 400, // package comments resource ID
-
- 0, // package size ( if 0, filled by ScriptCheck )
-
- "TeachText • 3", // Custom Install selection description
- {
- 'infa', 4000; // file to install or remove
- },
- }
- };
-
- resource 'inpk' ( kDividerPackage ) {
- format0 {
- showsOnCustom, // show the divider as package or subpackage
-
- notRemovable, // don't allow divider to be selected
- // under Custom Removal mode
-
- dontForceRestart, // don't make user reboot after removal
-
- 0, // doesn't need package comments
-
- 0, // package size is empty
-
- "-", // display divider line
- {
- // contents list needs to be empty
- // for divider packages
- },
- }
- };
-
-
-
- // • package comments
-
- // NOTE: The actual file that will be installed in either package is actually
- // TeachText. The information detailed below does not actually correspond to
- // the file being installed and is intended only as an example of how to
- // prepare custom package information resources.
-
- // FURTHER NOTE: The values that are assigned to the Custom Package Information
- // resource fields do not actually have any effect on the installation and
- // are ignored during installation. They can however assist the user in
- // choosing which packages they would like to include in their Custom
- // Installation or Custom Removal.
-
- // The following included file contains the icons for the two package comments.
- // I created the file with the icon resources ( 'ICN#', 'icl4', 'icl8' )
- // by opening the application to be installed within ResEdit. I then copied the
- // 'ICN#', 'icl4' and 'icl8' icon resources into a new ResEdit file called
- // "Icons.rsrc" and assigned the resource items an ID of 9128, since their
- // original resource ID's had a value that was illegal for use with 'inpc'
- // resources ( they must be over 1024 ).
- // - An alternative to this method is to derez the application and to paste
- // the resulting resource definitions into this script file and to let the
- // Rez command build the icons every time that the Installer script is Rezzed.
- // If you happen to forget to include the resources for the icons, ScriptCheck
- // will complain, but you will still be able to use the Rezzed Installer script
- // to successfully perform an installation.
- include "Icons.rsrc";
-
- resource 'inpc' ( kMainPackage ) {
- format1 {
- 8081994, // sample date ( 08/08/94 )
- 403, // sample version ( 4.0.3 )
-
- 4500 * 1024, // RAM required for package ( 4.5 megabytes )
-
- 9128, // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item is in included rsrc file
-
- kMainPackage, // 'TEXT' resource ID of item
- // containing package description
-
- }
- };
-
- resource 'inpc' ( 200 ) {
- format1 {
- 8081994, // sample date ( 08/08/94 )
- 403, // sample version ( 4.0.3 )
-
- 3500 * 1024, // RAM required for package ( 3.5 megabytes )
-
- 9128, // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item is in included rsrc file
-
- 200, // 'TEXT' resource ID of item
- // containing package description
-
- }
- };
-
- resource 'inpc' ( 300 ) {
- format1 {
- 8081994, // sample date ( 08/08/94 )
- 403, // sample version ( 4.0.3 )
-
- 4000 * 1024, // RAM required for package ( 4.0 megabytes )
-
- 9128, // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item is in included rsrc file
-
- 300, // 'TEXT' resource ID of item
- // containing package description
-
- }
- };
-
- resource 'inpc' ( 400 ) {
- format1 {
- 8081994, // sample date ( 08/08/94 )
- 403, // sample version ( 4.0.3 )
-
- 4500 * 1024, // RAM required for package ( 4.5 megabytes )
-
- 9128, // icon resource ID ( 'ICN#', 'icl4', 'icl8' )
- // - ID must be greater than 1024
- // - resource item in rezzed script file
-
- 400, // 'TEXT' resource ID of item
- // containing package description
-
- }
- };
-
-
-
- // The following resource items can easily be created manually by creating
- // 'TEXT' resource items in a ResEdit file and including that file in this
- // script.
- // USE: include "fileWithTextItem.rsrc";
- // Resource includes use "include" instead of "#include"
- // and are terminated with a semicolon.
-
- // NOTE: The new package comment resource ( 'inpc' ) allows descriptions beyond
- // the 255 character limit of the old comment resource ( 'icmt' ), by using
- // 'TEXT' type resources for the package description field. 'TEXT' type
- // resources are limited to 32K.
-
- data 'TEXT' ( kMainPackage ) {
- "This package contains 'TeachText • 1', 'TeachText • 2' and 'TeachText • 3'. "
- "These items will be installed to a user selectable folder during Custom "
- "Install and 'TeachText • 1' and 'TeachText • 2' will be removed during "
- "Custom Remove. "
- };
-
- data 'TEXT' ( 200 ) {
- "This package contains 'TeachText • 1'. "
- };
-
- data 'TEXT' ( 300 ) {
- "This package contains 'TeachText • 2'. "
- };
-
- data 'TEXT' ( 400 ) {
- "This package contains 'TeachText • 3'. "
- };
-
-
-
- // • file atoms
-
- // file atom for TeachText application #1
- resource 'infa' (2000) {
- format1 {
- deleteWhenRemoving, // Remove during removal
- deleteWhenInstalling, // Remove during installation
- copy, // Copy on Install
- dontIgnoreLockedFile, // Respect file locking
- dontSetFileLocked, // Don't lock installed file
- useSrcCrDateToCompare, // Compare using creation date
- srcNeedExist, // Make sure file is on install disk
- rsrcForkInRsrcFork, // Put resource info in resource fork
- leaveAloneIfNewer, // Warn before updating a newer file
-
- updateExisting, // Okay to overwrite existing file
- copyIfNewOrUpdate, // Okay to install if tgt doesn't exist
-
- rsrcFork, // Include resource fork
- dataFork, // Include data fork
-
- 0, // File size ( filled in by ScriptCheck
- // if this value is zero )
-
- 0x0, // Finder attributes flags ( filled in
- // by ScriptCheck if this value is zero )
-
- 10001, // Target spec for file
- {
- 10000, // Source spec for file
-
- 0, // Source Data fork size ( filled in
- // by ScriptCheck if this value is zero )
-
- 0 // Source Resource fork size ( filled in
- // by ScriptCheck if this value is zero )
- },
-
- 0, // The source version number in BCD format
- // Ignored when comparing by date
-
- 0, // Version compare procedure ( 0 : none )
-
- 0, // Atom extender resource ID ( 0 : none )
-
- "TeachText from Disk 1"
- // Use this field if you wish to substitute
- // some description for the file being installed
- // or removed. If "" is used, then Installer
- // will use the filename.
-
- // NOTE: The Installer will display the filename
- // or value entered here after the messages
- // "Reading < file description >…"
- // "Writing < file description >…", etc.
- }
- };
-
- // file atom for TeachText application #2
- resource 'infa' (3000) {
- format1 {
- deleteWhenRemoving, // Remove during removal
- deleteWhenInstalling, // Remove during installation
- copy, // Copy on Install
- dontIgnoreLockedFile, // Respect file locking
- dontSetFileLocked, // Don't lock installed file
- useSrcCrDateToCompare, // Compare using creation date
- srcNeedExist, // Make sure file is on install disk
- rsrcForkInRsrcFork, // Put resource info in resource fork
- leaveAloneIfNewer, // Warn before updating a newer file
-
- updateExisting, // Okay to overwrite existing file
- copyIfNewOrUpdate, // Okay to install if tgt doesn't exist
-
- rsrcFork, // Include resource fork
- dataFork, // Include data fork
-
- 0, // File size ( filled in by ScriptCheck
- // if this value is zero )
-
- 0x0, // Finder attributes flags ( filled in
- // by ScriptCheck if this value is zero )
-
- 20001, // Target spec for file
- {
- 20000, // Source spec for file
-
- 0, // Source Data fork size ( filled in
- // by ScriptCheck if this value is zero )
-
- 0 // Source Resource fork size ( filled in
- // by ScriptCheck if this value is zero )
- },
-
- 0, // The source version number in BCD format
- // Ignored when comparing by date
-
- 0, // Version compare procedure ( 0 : none )
-
- 0, // Atom extender resource ID ( 0 : none )
-
- "TeachText from Disk 2"
- // Use this field if you wish to substitute
- // some description for the file being installed
- // or removed. If "" is used, then Installer
- // will use the filename.
-
- // NOTE: The Installer will display the filename
- // or value entered here after the messages
- // "Reading < file description >…"
- // "Writing < file description >…", etc.
- };
- };
-
- // file atom for TeachText application #3
- resource 'infa' (4000) {
- format1 {
- deleteWhenRemoving, // Remove during removal
- deleteWhenInstalling, // Remove during installation
- copy, // Copy on Install
- dontIgnoreLockedFile, // Respect file locking
- dontSetFileLocked, // Don't lock installed file
- useSrcCrDateToCompare, // Compare using creation date
- srcNeedExist, // Make sure file is on install disk
- rsrcForkInRsrcFork, // Put resource info in resource fork
- leaveAloneIfNewer, // Warn before updating a newer file
-
- updateExisting, // Okay to overwrite existing file
- copyIfNewOrUpdate, // Okay to install if tgt doesn't exist
-
- rsrcFork, // Include resource fork
- dataFork, // Include data fork
-
- 0, // File size ( filled in by ScriptCheck
- // if this value is zero )
-
- 0x0, // Finder attributes flags ( filled in
- // by ScriptCheck if this value is zero )
-
- 30001, // Target spec for file
- {
- 30000, // Source spec for file
-
- 0, // Source Data fork size ( filled in
- // by ScriptCheck if this value is zero )
-
- 0 // Source Resource fork size ( filled in
- // by ScriptCheck if this value is zero )
- },
-
- 0, // The source version number in BCD format
- // Ignored when comparing by date
-
- 0, // Version compare procedure ( 0 : none )
-
- 0, // Atom extender resource ID ( 0 : none )
-
- "TeachText from Disk 3"
- // Use this field if you wish to substitute
- // some description for the file being installed
- // If "" is used, then Installer
- // will use the filename.
-
- // NOTE: The Installer will display the filename
- // or value entered here after the messages
- // "Reading < file description >…"
- // "Writing < file description >…", etc.
- };
- };
-
-
- // • file specs
-
- // target file spec for TeachText application #1
- resource 'intf' (10001) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'APPL', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- "folder-user:TeachText • 1" // path to target file
- }
- };
-
-
- // source file spec for TeachText application #1
- resource 'infs' (10000) {
- 'APPL', // TYPE for source file
- 'ttxt', // CREATOR for source file
- 0x1, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 1:TeachText • 1" // PATH to source file
- };
-
- // target file spec for TeachText application #2
- resource 'intf' (20001) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'APPL', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- "folder-user:TeachText • 2" // path to target file
- }
- };
-
- // source file spec for TeachText application #2
- resource 'infs' (20000) {
- 'APPL', // TYPE for source file
- 'ttxt', // CREATOR for source file
- 0x1, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 2:TeachText • 2" // PATH to source file
- };
-
- // target file spec for TeachText application #3
- resource 'intf' (30001) {
- format1 {
- noSearchForFile, // use default search path
-
- TypeCrMustMatch, // If this is set to TypeCrMustMatch
- // then a file with a different type
- // and creator than those specified
- // below will not be replaced.
- // If this is set to TypeCrNeedNotMatch
- // then type and creator of an existing
- // target file are ignored.
-
- // The Type and Creator fields will be used to set the
- // file's Type and Creator when a new file is created.
- 'APPL', // TYPE for new file
- 'ttxt', // CREATOR for new file
-
- 0, // finder attribute flags
- // filled by ScriptCheck is value is 0
-
- 1, // creation date for new file
- 1, // modification date for new file
- // NOTE: DATE values are filled
- // by ScriptCheck if the value is 1
-
- 0, // search proc ID ( 'insp' ), none used
-
- "folder-user:TeachText • 3" // path to target file
- }
- };
-
- // source file spec for TeachText application #3
- resource 'infs' (30000) {
- 'APPL', // TYPE for source file
- 'ttxt', // CREATOR for source file
- 0x1, // creation DATE for source file
- noSearchForFile, // IGNORED in Installer 4.0.x
- TypeCrMustMatch, // TYPE, CREATOR must match file on install disk
- "Disk 3:TeachText • 3" // PATH to source file
- };
-
- // • Installer prefs resource
-
- include "HelpPicts.rsrc";
-
- resource 'inpr' ( 300 ) {
- format0{
- useFolderTargetMode, // allow user to select target folder
- // instead of only choosing target volume
-
- dontAllowUserToSetSystemDisk,
- // don't allow user to override default
- // volume as destination for system files
-
- showSelectedSizeInCustom,
- // show user how much disk space will be
- // required for installation of selected files
-
- noSetupFunctionSupplied,// not using a setup function code resource
-
- dontAllowCleanInstall, // Reserved for use by Apple System Software
- // Installer scripts. Should always be
- // dontAllowCleanInstall.
-
- dontAllowServerAsTarget,// don't allow user to install to
- // an Apple Share volume or server
- // See warnings in Installer Tech. Guide about
- // using allowServerAsTarget.
-
- '', // setup function type ( none supplied )
- 0, // setup function code rsrc ID ( none supplied )
-
- // NOTE: The setup function feature allows
- // you to select the default target volume and
- // default target folder from within a code rsrc.
- // This feature is only available when
- // 'setupFunctionSupplied' is specified.
-
- // If 'useFolderTargetMode' then the setup function
- // can set the default target volume and default target
- // folder. If 'useDiskTargetMode' is specified then
- // the setup function can only set the default target
- // volume.
-
- // See the "Setup Function Example" for a
- // demonstration of how to implement a setup
- // function in your Installer script.
-
- {
- // NOTE: In the examples below, all the PICT's are actually 8-bit
- // grayscale images. This was done for sake of simplicity, since
- // these images are suitable for display in either monochrome or
- // color and reduce the number of images that needed to be included
- // for this example.
-
- // • Help PICT's in General
-
- // - On any given screen, when the Installer Help Dialog is open
- // there will be two PICT's displayed. One PICT which is tall and thin
- // is displayed on the left is intended to contain some kind of graphic.
- // The other PICT which is wide and short, is displayed on the right, and
- // is intended to contain text imbedded in a PICT.
-
- // - If the screen that the Help Dialog is displayed on is a monochrome
- // screen, then the first pair of PICT's will be displayed for the
- // current page of the Installer Help.
-
- // - If the screen that the Help Dialog is displayed within is a color
- // screen, then the second pair of PICT's will be displayed for the
- // current page of the Installer Help.
-
- // - As the user clicks in the PREVIOUS and NEXT buttons that appear
- // in the Help Dialog, the pages will be advanced according to the
- // order that the sets of PICT's are defined below.
-
- // - When the Installer draws the PICT's in the Help Dialog, no resizing
- // is preformed. This means that everything too large to fit into the
- // Help Dialog will be clipped to the size of the window and will be
- // invisible to the user.
-
- // • the help PICT resources that come with the Apple Installer 4.0
-
- // - These resources are actually in the Installer app itself and will
- // automatically appear when the HELP button is pressed in the Installer
- // if the 'inpr' is defined as it is below for help pages #1 and #2
-
- // help page #1
-
- 301, // B/W graphic section (ID of 'PICT' rsrc)
- 311, // B/W text section (ID of 'PICT' rsrc)
- 301, // 8-Bit Color graphic section (ID of 'PICT' rsrc)
- 311, // 8-Bit Color text section (ID of 'PICT' rsrc)
-
- // help page #2
- 302, // B/W graphic section (ID of 'PICT' rsrc)
- 312, // B/W text section (ID of 'PICT' rsrc)
- 302, // 8-Bit Color graphic section (ID of 'PICT' rsrc)
- 312, // 8-Bit Color text section (ID of 'PICT' rsrc)
-
- // • some customized help PICT resources added for this example
-
- // - the PICT resources listed below were created in graphics program
- // by copying the PICT's out of the Installer application, and then
- // pasting them into a graphics application. The original PICT images
- // were modified ( being careful to keep the items the exact same size )
- // and then pasted into a file called "HelpPicts.rsrc". This file was
- // then included in the Installer script immediately above the beginning
- // of the definition of this 'inpr' resource.
-
- // help page #3
- 9128, // B/W graphic section (ID of 'PICT' rsrc)
- 9129, // B/W text section (ID of 'PICT' rsrc)
- 9128, // 8-Bit Color graphic section (ID of 'PICT' rsrc)
- 9129, // 8-Bit Color text section (ID of 'PICT' rsrc)m
-
- // etc., continue with additional sets of help pages
- },
-
- "Custom UI Example" // default target folder name
-
- // NOTE: This field is only used when
- // 'useFolderTargetMode' is specified.
- // This field is ignored when 'useDiskTargetMode'
- // is specified.
- }
-
- };
-
-
-